import React from 'react';
import { Form, Input, Select, DatePicker, Modal } from 'dw-mx';
import { Code } from 'dw-mx-extend';

export default function ExpertsEdit(props) {
    const [form] = Form.useForm();
    const formItemLayout = {
        labelCol: { span: 4 },
        wrapperCol: { span: 20 },
    };
    const datasource = props.content;

    return (
        <Modal
            title="维护鉴定科室"
            visible={true}
            width={600}
            onOk={() => {
                const data = form.getFieldsValue();
                return props.closeEdit(data);
            }}
            onCancel={() => {
                props.closeEdit(datasource);
            }}
        >
            <div style={{ marginBottom: 10 }}>
                <Form form={form} {...formItemLayout} initialValues={props.content}>
                    <Form.Item label="姓名" name="experts_name" rules={[{ required: true }]}>
                        <Input maxLength={128} />
                    </Form.Item>
                    <Form.Item label="性别" name="experts_sex" rules={[{ required: true }]}>
                        <Select options={Code.STRINGCODE('1:男,2:女')} style={{ width: 200 }} />
                    </Form.Item>
                    <Form.Item label="联系电话" name="phone" rules={[{ required: true }]}>
                        <Input maxLength={128} />
                    </Form.Item>
                    <Form.Item name="office" label="所属科室" rules={[{ required: true }]}>
                        <Select
                            style={{ width: 200 }}
                            placeholder="请选择科室"
                            options={Code.JSONCODE([
                                { value: '1', content: '内科' },
                                { value: '2', content: '外科' },
                                { value: '3', content: '儿科' },
                            ])}
                        />
                    </Form.Item>
                    <Form.Item label="外出时间" name="dateSign" rules={[{ required: true }]}>
                        <DatePicker picker={'date'} format={'YYYY-MM-DD HH:mm:ss'} />
                    </Form.Item>
                </Form>
            </div>
        </Modal>
    );
}
